﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace Imgur.Net.Auth
{
    /// <summary>
    /// Interface for providers of authentication contexts.
    /// </summary>
    public interface ImgurAuthProvider
    {
        /// <summary>
        /// Gets an authorization context for use in subsequent calls to Imgur.
        /// </summary>
        /// <returns></returns>
        ImgurAuthContext GetAuthorizationContext();

        /*
        /// <summary>
        /// Creates an authentication context which will provide valid anonymous authentication to the Imgur service.
        /// </summary>
        /// <returns>An anonymous authentication context.</returns>
        ImgurAuthContext GetAnonymousAuthContext();

        /// <summary>
        /// Creates an ImgurAuthContext from an existing Access token. 
        /// </summary>
        /// <param name="credentials">Current registration tokens set that contains an access token</param>
        /// <returns>an ImgurAuthContext to be used in subsequent requests.</returns>
        /// <remarks>Should be used generally if the state of a token context is AuthorizationExists</remarks>
        ImgurAuthContext GetRegisteredUserAuthContextFromAccessToken(RegistrationTokenContext credentials);

        /// <summary>
        /// Creates an ImgurAuthContext from an existing refresh token. The returned ImgurAuthContext will contain the new token
        /// set created by the refresh.
        /// </summary>
        /// <param name="credentials">Current registration token set that contains a refresh token</param>
        /// <returns>An ImgurAuthContext to be used in subsequent requests.</returns>
        /// <remarks>Should be used generally if the current state of a token set is RequiresLoginNoAccessToken or RequiresLoginExpired</remarks>
        ImgurAuthContext GetRegisteredUserAuthContextFromRefreshToken(RegistrationTokenContext credentials);

        /// <summary>
        /// Creates an ImgurAuthContext from a new login. 
        /// </summary>
        /// <param name="credentialsFunction">Function that takes the URI of the authorize endpoint and returns a token set.</param>
        /// <returns>The most interactive of all authorization states this function is used when a brand new authentication is needed. The function
        /// given will receive the URI of the authorize endpoint at the Imgur site, and should use this to allow the user to input their
        /// username/password/etc. The response from that login should be parsed and returned from the function. It is suggested that
        /// the AuthUtils class be used to assist in parsing this response, though this is not strictly necessary.</returns>
        ImgurAuthContext GetRegisteredUserAuthContextFromNewLogin(Func<Uri, RegistrationTokenContext> credentialsFunction);

        RegisteredAuthorizationState CheckRegisteredAuthorizationTokenState(RegistrationTokenContext tokens);
        */
    }
}
